#include <reg52.h>

sbit LED = P2^0;
sbit vibrate = P3^1;
sbit BEEP = P2^5;

void Delay(unsigned int ten)
{
	while(ten--);
}

void Beep()
{
	unsigned int i = 5000;
	while(i--)
	{
		BEEP = !BEEP;
		Delay(40);
	}
}

void main()
{
	while(1)
	{
		if(vibrate == 0)
		{
			LED = 0;
			Beep();
			LED = 1;
		}
		else
		{
			LED = 1;
			
		}
	}
}